#version 300 es

precision mediump float;

uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;

#define MINFREQ 1.0
#define MAXFREQ 1000.0
#define SWIDTH 0.001
#define PI 3.141592654

out vec4 OutColor;



float hash3d(ivec3 v) 
{
    float value = randTable[v.x % 256];
    
}

void main() {
    vec2 uv = gl_FragCoord.xy / u_resolution;

    vec2 p = uv * vec2(1.0) + vec2(0.0);

    float value = 0.0;
    float swidth = SWIDTH * abs(u_mouse.x-u_resolution.x/2.0);
    float cutoff = clamp(0.5/swidth, 0.0, MAXFREQ);
    for (float f = MINFREQ; f < cutoff; f *= 2.0) {
        value += sin(2.0 * PI * f * p.x) / f;
    }

    vec3 col = vec3(value);


    col = pow(col, vec3(1.0/2.2));

    OutColor = vec4(col, 1.0);
}